package com.atguigu.lease.common.context;


import com.atguigu.lease.common.utils.JwtUtil;
import io.jsonwebtoken.Claims;
import jakarta.servlet.http.HttpServletRequest;

public class LoginUserContext {
    public static ThreadLocal<LoginUser> loginUserThreadLocal = new ThreadLocal<>();

public static Long getLoginUserId(String token) {
    Claims claims = JwtUtil.parseToken(token);
    Long userId = claims.get("userId", Long.class);
    return userId;
}
    public static String getLoginUserPhone(String token) {
        Claims claims = JwtUtil.parseToken(token);
        String phone = claims.get("userPhone", String.class);
        return phone;
    }
}